package cn.nexd.map;

import junit.framework.TestCase;

import java.util.ArrayList;
import java.util.List;

import cn.nexd.map.location.collector.bean.WifiDataResult;
import cn.nexd.map.location.utils.Log;
import cn.nexd.map.rendering.core.helper.WifiSignalHelper;

/**
 * Created by lawrence on 2015/11/16.
 */
public class WifiSignalHelperTest extends TestCase {

    public void testGetAvgWifiDataResult() throws Exception {
        WifiDataResult result_1 = new WifiDataResult();
        result_1.setBssid("" + 1);
        result_1.setLevel(-10);

        WifiDataResult result_2 = new WifiDataResult();
        result_2.setBssid("" + 2);
        result_2.setLevel(-20);

        WifiDataResult result_3 = new WifiDataResult();
        result_3.setBssid("" + 3);
        result_3.setLevel(-30);


        List<WifiDataResult> wifiDataResults_1 = new ArrayList<>();
        wifiDataResults_1.add(result_1);
        wifiDataResults_1.add(result_2);
        wifiDataResults_1.add(result_3);

        List<WifiDataResult> wifiDataResultList_1 = WifiSignalHelper.getAvgWifiDataResult(wifiDataResults_1);
        for (WifiDataResult wifiDataResult : wifiDataResultList_1) {
            Log.i("测试wifi结果 _1", wifiDataResult.getBssid() + "__" + wifiDataResult.getLevel());
        }

        WifiDataResult result_4 = new WifiDataResult();
        result_4.setBssid("" + 4);
        result_4.setLevel(-40);


        WifiDataResult result_5 = new WifiDataResult();
        result_5.setBssid("" + 2);
        result_5.setLevel(-40);


        WifiDataResult result_6 = new WifiDataResult();
        result_6.setBssid("" + 3);
        result_6.setLevel(-40);


        WifiDataResult result_7 = new WifiDataResult();
        result_7.setBssid("" + 5);
        result_7.setLevel(-40);

        List<WifiDataResult> wifiDataResults_2 = new ArrayList<>();
        wifiDataResults_2.add(result_5);
        wifiDataResults_2.add(result_6);
        wifiDataResults_2.add(result_7);
        wifiDataResults_2.add(result_4);
        List<WifiDataResult> wifiDataResultList_2 = WifiSignalHelper.getAvgWifiDataResult(wifiDataResults_2);
        for (WifiDataResult wifiDataResult : wifiDataResultList_2) {
            Log.i("测试wifi结果 _2", wifiDataResult.getBssid() + "__" + wifiDataResult.getLevel());
        }
    }
}